package com.blt.govdata.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.blt.govdata.mapper.ProjectBasicInfoMapper;
import com.blt.govdata.service.IProjectBasicInfoService;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA
 * Description:
 * Author:GongJun
 * Date:2018/3/27
 * Time:18:19
 * blt Technologies Co., Ltd.
 */
@Service
public class ProjectBasicInfoServiceImpl extends ServiceImpl<ProjectBasicInfoMapper,T> implements IProjectBasicInfoService {

    @Autowired
    ProjectBasicInfoMapper mapper;

    @Override
    public List<Map<String, Object>> projectAudit(Map<String, Object> params) {
        return this.mapper.projectAudit(params);
    }

    @Override
    public List<Map<String, Object>> projectBasicInfo(Map<String, Object> params) {

        List<Map<String, Object>> list  = this.mapper.projectBasicInfo(params);
        if(CollectionUtils.isEmpty(list)){
            Map<String,Object> map = Maps.newHashMap( );
            map.put("name",null);
            map.put("imagePaths",null);
            map.put("termStart",null);
            map.put("termEnd",null);
            map.put("content",null);
            map.put("investment",null);
            map.put("owner",null);
            map.put("landuse",null);
            map.put("remarks",null);
            map.put("isImportant",null);
            map.put("leadUnit",null);
            map.put("mangerLeader",null);
            map.put("buildUnit",null);
            map.put("buildPhone",null);
            list = Lists.newArrayList( );
            list.add(map);
        }
        return list;
    }

    @Override
    public List<Map<String, Object>> projectProgressInfo(Map<String, Object> params) {
        List<Map<String, Object>> list = this.mapper.projectProgressInfo(params);
        if(CollectionUtils.isEmpty(list)){
            Map<String,Object> map = Maps.newHashMap( );
            map.put("content",null);
            list = Lists.newArrayList( );
            list.add(map);
        }
        return list;
    }

    @Override
    public List<Map<String, Object>> existFaq(Map<String, Object> params) {
        List<Map<String, Object>> list = this.mapper.existFaq(params);
        if(CollectionUtils.isEmpty(list)){
            Map<String,Object> map = Maps.newHashMap( );
            map.put("content",null);
            list = Lists.newArrayList( );
            list.add(map);
        }
        return list;
    }

    @Override
    public List<Map<String, Object>> nextMeasure(Map<String, Object> params) {
        List<Map<String, Object>> list = this.mapper.nextMeasure(params);
        if(CollectionUtils.isEmpty(list)){
            Map<String,Object> map = Maps.newHashMap( );
            map.put("content",null);
            list = Lists.newArrayList( );
            list.add(map);
        }
        return list;
    }

    @Override
    public List<Map<String, Object>> workTask(Map<String, Object> params) {
        return this.mapper.workTask(params);
    }

    @Override
    public List<Map<String, Object>> workProgress(Map<String, Object> params) {
        List<Map<String, Object>> list =  this.mapper.workProgress(params);
        if(CollectionUtils.isEmpty(list)){
            Map<String,Object> map = Maps.newHashMap( );
            map.put("id",null);
            map.put("inputUnit",null);
            map.put("progressSituation",null);
            list = Lists.newArrayList( );
            list.add(map);
        }
        return list;
    }

    @Override
    public List<Map<String, Object>> landUsageInfo(Map<String, Object> params) {
        List<Map<String, Object>> list = this.mapper.landUsageInfo(params);
        if(CollectionUtils.isEmpty(list)){
            Map<String,Object> map = Maps.newHashMap( );
            map.put("buildArea",null);
            map.put("hookArea",null);
            map.put("yearArea",null);
            map.put("approvalArea",null);
            map.put("approvalNum",null);
            map.put("cardArea",null);
            map.put("landNature",null);
            map.put("landNum",null);
            map.put("landLife",null);
            map.put("extent",null);
            list = Lists.newArrayList( );
            list.add(map);
        }
        return list;
    }

    @Override
    public List<Map<String, Object>> yearPlan(Map<String, Object> params) {
         List<Map<String, Object>> list = this.mapper.yearPlan(params);
        if(CollectionUtils.isEmpty(list)){
            Map<String,Object> map = Maps.newHashMap( );
            map.put("month",null);
            map.put("monthInvestment",null);
            map.put("monthConetnt",null);
            list = Lists.newArrayList( );
            list.add(map);
        }
        return list;
    }

    @Override
    public List<Map<String, Object>> monthPlan(Map<String, Object> params) {
        return this.mapper.monthPlan(params);
    }

    @Override
    public List<Map<String, Object>> rigorousSituation(Map<String, Object> params) {
        List<Map<String, Object>> list = this.mapper.rigorousSituation(params);
        if(CollectionUtils.isEmpty(list)){
            Map<String,Object> map = Maps.newHashMap( );
            map.put("workContent",null);
            map.put("responseUnit",null);
            map.put("remarks",null);
            map.put("progressSituation",null);
            list = Lists.newArrayList( );
            list.add(map);
        }
        return list;
    }


}
